* 10 Line BASIC Challenge    *
* PUR-80 Category submission *


TITLE    : Bomber
PLATFORM : Oric-1


GAME DESCRIPTION

Your bomber is out of fuel and losing altitude. You must clear the gound below
you of derelict buildings by using your bombs to destroy them before you hit a
building.

When the game is started, player is asked to enter the starting level.  The
higher the number, the taller the building.  Recommend to start around level 3
to 5 which starts easy enough but is still challenging to clear the buildings.

When the level starts, press any key to release a bomb.  Only one bomb can be
dropped at a time so be careful to aim well.  Points are awarded based on the
game level (e.g. level 5 is 5 points per building block destroyed).

If all buildings are cleared and the plane gets to the green runway strip then
the game starts again at the next level.

If a building is hit then the game is over, only one life!  It's a challenging
game even on low levels.

My best score is 1800 starting on level 8 - I'm sure people can easily beat
this :-)


INSTALLATION INSTRUCTIONS

Recommend to use an Oric-1 emulator, I have used Oricutron 1.2 which runs fine
on Windows 10.

1. Download the zip file from here:
http://www.emucamp.com/oric/oricutron/windows/Oricutron_win32_v12.zip

2. Extract to a folder called Oric or similar

3. Copy the file BOMBER.TAP to the Oric\tapes folder

4. Start the emulator oricutron.exe (Atmos mode)

5. You must set it to Oric-1 mode as follows:
5.1 Press F1 to pull up menu options
5.2 Press H to select hardware options
5.3 Press 1 to selection Oric-1
5.4 Emulator will cold-start Oric-1
5.5 type CLOAD"BOMBER.TAP" and press enter
5.6 Game will load almost instantly
5.7 type LIST to show the program
5.8 type RUN to play the game


TECHNICAL DESCRIPTION

Oric BASIC only allows less than 80 characters per line hence PUR-80 category.

Some constants are used such as Z0=0 and Z1=1 as this results in slightly
faster decode than numbers which must be translated from ASCII to floating
point each time.

Variable W is used to delay the game loop by a different amount depending if
there is a bomb falling or not. This is to try and keep the game speed the
same rather than the plane suddenly slowing down because a bomb has to also
be drawn.

The REPEAT..UNTIL construct was very useful because it allows going back to
a line mid-statement (GOTO would of course go to the start of a line).

This uses the standard text mode of the Oric, which is 40 columns by 28 rows.

Oric display uses serial attributes, which treats display memory less than 32
special instructions for example to change the background for foreground
colour.  This is memory efficient but not ideal for multi-colour games as each
change of colour takes up a column which cannot contain any image.

To get additional colours, the inverse trick is used.  The Oric has only up to
128 characters, so any value with top bit set is shown in inverse.  Simply
this means that the normal foreground or background colour is XORed with 7 for
characters greater than 127.

I have chosen forground colour 6 (cyan) and background colour 4 (blue) for my
game. The inverse is colour 1 (red) for foreground and colour 3 (yellow) for
background.  I use this effect for the buildings which is just a simple
checkerboard pattern but comes out as red and yellow.  The bomb is cyan as that
is the normal foreground colour. However the plane is red because I set the
colour attribute before the plane graphic to change the foreground colour.

At the bottom row, I poke the background colour to green to act as the ground
level.

Hence it is possible to create a simple multi-colour game in BASIC without too
much difficulty despite the limitations of the serial attribute hardware.

The game is simple enough to squeeze in user defined graphics.  The plane is 3
characters and the bomb is 1 character.  The 4 characters are designed using a
6x8 matrix, which is narrower than the usual 8x8 found on computers like C64
or Atari.

I used the lower case letters a through to d for the graphics and avoided
using lower case in the game.  The graphics for these characters is from 46856
to 45887 in the Oric-1 memory map.

Here are the designs and values to poke :-)
 
Pattern                         a  	b   	c
				0	0	0
11    11    			48	48	0
111    111			56	28	0
111111111111111			63	63	56
 1111111111111111		31	63	62
  1111111111111111		15	63	63
      111			0	56	0
     11				1	32	0

Pattern 			d
111111				63
111111				63
  11				12
 1111   			30
111111  			63
111111				63
 1111				30
  11				12
  

PROGRAM LISTING

1 PAPER4:INPUTG:GOSUB9:REPEAT:CLS:POKE49080,18:POKE48041,2:GOSUB7:Z1=1      
2 FORY=Z1TOBT:FORX=Z0TO34:S=SCRN(X+3,Y):PLOTX,Y,P$:IFS=BTHENEXPLODE:END     
3 W=6:IFKEY$<>""ANDBX=Z0ANDY<BTTHENBX=X+2:BY=Y:OY=Y+Z1:SHOOT                
4 IFBX<>Z0THENW=3:BY=BY+Z1:H=SCRN(BX,BY):PLOTBX,OY,32:OY=BY:IFBY>BTTHENBX=Z0
5 IFBX<>Z0THENPLOTBX,BY,100:IFH=BTHENW=Z1:SC=SC+10:PLOT7,Z0,STR$(SC)        
6 WAITW:NEXT:PLOTX,Y,"   ":NEXT:PLOT14,12,"WELL DONE!":ZAP:ZAP:G=G+1:UNTIL0 
7 PLOT1,0,"SCORE:"+STR$(SC):X=1:Y=1:BX=0:P$=CHR$(1)+"abc":B=254:Z0=0        
8 INK6:FORP=4TO33:FORQ=25-INT(RND(1)*G*2)TO25:PLOTP,Q,B:NEXT:NEXT:RETURN    
9 FORA=46856TO46887:READP:POKEA,P:NEXT:BT=25:RETURN:DATA0,48,56,63,31,15,0,1
10 DATA0,48,28,63,63,63,56,32,0,0,0,56,62,63,0,0,63,63,12,30,63,63,30,12    
